<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="UTF-8" name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css">
    <script src="https://cdn.staticfile.org/jquery/2.1.1/jquery.min.js"></script>
    <script src="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>
    <title>一个用户</title>
</head>
<body>
<nav class="breadcrumb" role="navigation">
    <div class="container">
        <div class="row">
            <!-- Brand and toggle get grouped for better mobile display -->
            <div class="navbar-header">
                <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
                    <span class="sr-only">Toggle navigation</span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                </button>
                <a class="navbar-brand" href="#">June 19 Coffee</a>
            </div>

            <!-- Collect the nav links, forms, and other content for toggling -->
            <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
                <ul class="nav navbar-nav main-nav  clear navbar-right ">
                    <li><a class="navactive color_animation" href="/admin">主页</a></li>
                    <li><a class="color_animation" href="/admin/AllUsersMarks">积分总览</a></li>
                </ul>
            </div><!-- /.navbar-collapse -->
        </div>
    </div><!-- /.container-fluid -->
</nav>
<table class="table table-striped">
    <caption>客户</caption>
    <thead>
    <tr>
        <th>id</th>
        <th>昵称</th>
        <th>积分</th>
        <th>操作</th>
    </tr>
    </thead>
    <tbody>
    <tr>
        <td th:text="${mark.userId}"></td>
        <td th:text="${mark.name}"></td>
        <td th:text="${mark.mark}"></td>
        <td><div class="btn-group">
            <button type="button" class="btn btn-default dropdown-toggle"
                    data-toggle="dropdown">
                ... <span class="caret"></span>
            </button>
            <ul class="dropdown-menu" role="menu">
                <li><a class="navactive color_animation" data-toggle="modal" data-target="#increase">增加积分</a></li>
                <li><a class="navactive color_animation" data-toggle="modal" data-target="#reduce">扣除积分</a></li>
            </ul>
        </div></td>
    </tr>
    </tbody>
</table>
<div>
    <h3 th:if="${message=='error'}" style="color: #c9302c">积分不足!!!!!!!!!!!!!!</h3>
</div>

<!-- 模态框（加积分） -->
<div class="modal fade" id="increase" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
                    &times;
                </button>
                <h4 class="modal-title" id="myModalLabel">
                    加多少积分丫！
                </h4>
            </div>
            <div class="modal-footer">
                <!-- 模态框（加积分表单） -->
                <form class="form-horizontal" role="form" th:action="@{'/admin/addMark/'+${mark.userId}}" method="post">
                    <div class="form-group">
                        <label for="firstname" class="col-sm-2 control-label">id</label>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" id="firstname" name ="mark"
                                   placeholder="加多少积分">
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="col-sm-offset-2 col-sm-10">
                            <button type="submit" class="btn btn-default">确认</button>
                        </div>
                    </div>
                </form>
            </div>
        </div><!-- /.modal-content -->
    </div><!-- /.modal -->
</div>

<!-- 模态框（扣除积分） -->
<div class="modal fade" id="reduce" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
                    &times;
                </button>
                <h4 class="modal-title" id="myModalLabel">
                    扣除多少积分丫！
                </h4>
            </div>
            <div class="modal-footer">
                <!-- 模态框（扣除积分表单） -->
                <form class="form-horizontal" role="form" th:action="@{'/admin/reduceMark/'+${mark.userId}}" method="post">
                    <div class="form-group">
                        <label for="firstname" class="col-sm-2 control-label">id</label>
                        <div class="col-sm-10">
                            <input type="text" class="form-control"  name ="mark"
                                   placeholder="扣除多少积分">
                        </div>
                        <div class="col-sm-10">
                            <input th:value="${mark.mark}" style="display:none" readonly="readonly" type="text" class="form-control"  name ="oldMark">
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="col-sm-offset-2 col-sm-10">
                            <button type="submit" class="btn btn-default">确认</button>
                        </div>
                    </div>
                </form>
            </div>
        </div><!-- /.modal-content -->
    </div><!-- /.modal -->
</div>
<div>
    <a href=""></a>
</div>
<table class="table table-striped">
    <caption>操作记录</caption>
    <thead>
    <tr>
        <th>操作</th>
        <th>操作时间</th>
    </tr>
    </thead>
    <tbody>
    <tr th:each="record:${records}">
        <td th:text="${record.operate}"></td>
        <td th:text="${record.operateTime}"></td>
    </tr>
    </tbody>
</table>
</body>
</html>